#!/bin/bash

echo "=== 测试调试器修复效果 ==="
echo "测试1: 正常流程（进程退出前打印变量）"
echo -e "launch ./test_variable_types\nbreak main\ncontinue\nprint global_array_var\nquit" | ./debugger 2>&1 | grep -E "(段错误|Segmentation fault|错误：进程|进程已退出)"

echo -e "\n测试2: 进程退出后尝试打印变量"
echo -e "launch ./test_variable_types\nbreak main\ncontinue\nquit\nprint global_array_var" | timeout 5s ./debugger 2>&1 | grep -E "(段错误|Segmentation fault|错误：进程|进程已退出)"

echo -e "\n测试完成"